﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<MedicalManagementSystem.Utils.PaginatedList<MedicalManagementSystem.Models.Patient>>" %>
<div align="center">
    <p>
        <%Html.RenderPartial("AjaxPager", Model); %>
    </p>
    <table class="data_table">
        <tr>
            <th/>
            <th>
                Имя
            </th>
            <th>
                Дата рождения
            </th>
            <th>
                Текущая карта
            </th>
        </tr>
        <% var peopleIndex = Model.PageIndex * Model.PageSize + 1; %>
        <% foreach (var patient in Model){%>
        <tr>
            <td>
                <%=peopleIndex++%>
            </td>
            <td>
                <%=Html.ActionLink(patient.Initials, "Details", new { id = patient.id })%>
            </td>
            <td><%=Html.Encode(patient.Birthday.ToShortDateString()) %></td>
            <td>
            <%if(patient.CurrentChart!=null) {%>
                <%=Html.ActionLink("Просмотреть", "Index", "PatientChart", new { id = patient.CurrentChart.id },null)%>
            <%} else {%>
                <%=Html.ActionLink("Создать", "Create", "PatientChart", new { patientId = patient.id }, null)%>
            <%} %>
            </td>
        </tr>
        <%}%>
    </table>
    <p>
        <%Html.RenderPartial("AjaxPager", Model);%>
    </p>
</div>
